package Utils;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.v4.content.FileProvider;


import java.io.File;

public class OCRUtils {

    /**
     * 身份证正面
     */
    public static void startIDCardFront(Activity sourceActivity, int requestCode) {
//        Intent intent = new Intent(sourceActivity, CameraActivity.class);
//        // 设置临时存储
//        intent.putExtra(CameraActivity.KEY_OUTPUT_FILE_PATH, FileUtil.getSaveFileSfzzm(sourceActivity).getAbsolutePath());
//        intent.putExtra(CameraActivity.KEY_CONTENT_TYPE, CameraActivity.CONTENT_TYPE_ID_CARD_FRONT);
//        sourceActivity.startActivityForResult(intent, requestCode);
    }

    /**
     * 身份证反面
     */
    public static void startIDCardBack(Activity sourceActivity, int requestCode) {
//        Intent intent = new Intent(sourceActivity, CameraActivity.class);
//        // 设置临时存储
//        intent.putExtra(CameraActivity.KEY_OUTPUT_FILE_PATH, FileUtil.getSaveFileSfzfm(sourceActivity).getAbsolutePath());
//        intent.putExtra(CameraActivity.KEY_CONTENT_TYPE, CameraActivity.CONTENT_TYPE_ID_CARD_BACK);
//        sourceActivity.startActivityForResult(intent, requestCode);
    }

    /**
     * 拍摄人脸(可选本地照片)
     */
    public static void startFace2(Activity sourceActivity, int requestCode) {
//        Intent intent = new Intent(sourceActivity, CameraActivity.class);
//        // 设置临时存储
//        intent.putExtra(CameraActivity.KEY_OUTPUT_FILE_PATH, FileUtil.getSaveFileFace(sourceActivity).getAbsolutePath());
//        intent.putExtra(CameraActivity.KEY_CONTENT_TYPE, "");
//        sourceActivity.startActivityForResult(intent, requestCode);
    }

    /**
     * 拍摄人脸
     */
    public static void startFace(Activity sourceActivity, int requestCode) {
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        Uri contentUri = FileProvider.getUriForFile(sourceActivity, "net.ck.cklm", FileUtil.getSaveFileFace
                (sourceActivity));
        intent.putExtra(MediaStore.EXTRA_OUTPUT, contentUri);
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        sourceActivity.startActivityForResult(intent, requestCode);
    }

    public static void startBankCard(Activity sourceActivity, int requestCode) {
//        Intent intent = new Intent(sourceActivity, CameraActivity.class);
//        intent.putExtra(CameraActivity.KEY_OUTPUT_FILE_PATH,
//                FileUtil.getSaveFile(sourceActivity).getAbsolutePath());
//        intent.putExtra(CameraActivity.KEY_CONTENT_TYPE, CameraActivity.CONTENT_TYPE_BANK_CARD);
//        sourceActivity.startActivityForResult(intent, requestCode);
    }

    /**
     * 拍摄银行卡反面
     */
    public static void startBankCardBack(Activity sourceActivity, int requestCode) {
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        Uri contentUri = FileProvider.getUriForFile(sourceActivity, "net.ck.cklm",
                FileUtil.getBankBackFile(sourceActivity));
        intent.putExtra(MediaStore.EXTRA_OUTPUT, contentUri);
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        sourceActivity.startActivityForResult(intent, requestCode);
    }

    /**
     * 拍摄银行卡反面(可选本地照片)
     */
    public static void startBankCardBack2(Activity sourceActivity, int requestCode) {
//        Intent intent = new Intent(sourceActivity, CameraActivity.class);
//        // 设置临时存储
//        intent.putExtra(CameraActivity.KEY_OUTPUT_FILE_PATH, FileUtil.getBankBackFile(sourceActivity).getAbsolutePath());
//        intent.putExtra(CameraActivity.KEY_CONTENT_TYPE, "");
//        sourceActivity.startActivityForResult(intent, requestCode);
    }

    /**
     * 拍摄营业执照
     */
    public static void startBusinessLicense(Activity sourceActivity, int requestCode) {
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        Uri contentUri = FileProvider.getUriForFile(sourceActivity, "net.ck.cklm",
                FileUtil.getBusinessLicense(sourceActivity));
        intent.putExtra(MediaStore.EXTRA_OUTPUT, contentUri);
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        sourceActivity.startActivityForResult(intent, requestCode);
    }

    /**
     * 拍摄营业执照(可选本地照片)
     */
    public static void startBusinessLicense2(Activity sourceActivity, int requestCode) {
//        Intent intent = new Intent(sourceActivity, CameraActivity.class);
//        // 设置临时存储
//        intent.putExtra(CameraActivity.KEY_OUTPUT_FILE_PATH, FileUtil.getBusinessLicense(sourceActivity).getAbsolutePath());
//        intent.putExtra(CameraActivity.KEY_CONTENT_TYPE, "");
//        sourceActivity.startActivityForResult(intent, requestCode);
    }

    /**
     * 拍摄门头(可选本地照片)
     */
    public static void startDoor(Activity sourceActivity, int requestCode) {
//        Intent intent = new Intent(sourceActivity, CameraActivity.class);
//        // 设置临时存储
//        intent.putExtra(CameraActivity.KEY_OUTPUT_FILE_PATH, FileUtil.getDoor(sourceActivity).getAbsolutePath());
//        intent.putExtra(CameraActivity.KEY_CONTENT_TYPE,"");
//        sourceActivity.startActivityForResult(intent, requestCode);
    }

    /**
     * 拍摄环境(可选本地照片)
     */
    public static void startEnvironment(Activity sourceActivity, int requestCode) {
//        Intent intent = new Intent(sourceActivity, CameraActivity.class);
//        // 设置临时存储
//        intent.putExtra(CameraActivity.KEY_OUTPUT_FILE_PATH, FileUtil.getEnvironment(sourceActivity).getAbsolutePath());
//        intent.putExtra(CameraActivity.KEY_CONTENT_TYPE,"");
//        sourceActivity.startActivityForResult(intent, requestCode);
    }

    /**
     * 拍摄照片
     */
    public static void startCapture(Activity sourceActivity, File picFile, int requestCode) {
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        Uri contentUri = FileProvider.getUriForFile(sourceActivity, "net.ck.cklm", picFile);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, contentUri);
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        sourceActivity.startActivityForResult(intent, requestCode);
    }

    /**
     * 拍摄照片(可选本地照片)
     */
    public static void startUserIcon(Activity sourceActivity, int requestCode) {
//        Intent intent = new Intent(sourceActivity, CameraActivity.class);
//        // 设置临时存储
//        intent.putExtra(CameraActivity.KEY_OUTPUT_FILE_PATH, FileUtil.getUserIconFile(sourceActivity).getAbsolutePath());
//        intent.putExtra(CameraActivity.KEY_CONTENT_TYPE, "");
//        sourceActivity.startActivityForResult(intent, requestCode);
    }


}
